<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>产品管理后台登录助手</title>
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
            text-align: center;
            padding: 40px;
            max-width: 600px;
            margin: 0 auto;
        }
        h1 {
            color: #1a73e8;
        }
        p {
            color: #555;
            line-height: 1.6;
        }
        .success {
            color: #28a745;
            font-weight: bold;
            margin-top: 20px;
        }
        .button {
            background-color: #1a73e8;
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
            margin-top: 20px;
            transition: background-color 0.3s;
        }
        .button:hover {
            background-color: #0d47a1;
        }
        .instructions {
            text-align: left;
            margin-top: 30px;
            padding: 20px;
            background-color: #f5f5f5;
            border-radius: 8px;
        }
        .instructions h3 {
            margin-top: 0;
            color: #333;
        }
        code {
            background-color: #e0e0e0;
            padding: 2px 6px;
            border-radius: 3px;
            font-family: monospace;
        }
    </style>
</head>
<body>
    <h1>产品管理后台登录助手</h1>
    <p>点击下方按钮自动设置登录状态，完成后您可以直接访问产品管理页面。</p>
    
    <button class="button" onclick="setLoginStatus()">设置登录状态</button>
    
    <div id="status" class="success" style="display: none;">
        ✓ 登录状态已成功设置！
    </div>
    
    <div class="instructions">
        <h3>使用说明：</h3>
        <ol>
            <li>点击上方"设置登录状态"按钮</li>
            <li>打开产品管理后台：<a href="http://localhost:5174/#admin-products" target="_blank">http://localhost:5174/#admin-products</a></li>
            <li>如果遇到问题，请刷新页面或重新运行此工具</li>
        </ol>
    </div>
    
    <script>
        function setLoginStatus() {
            try {
                // 设置登录状态到localStorage
                localStorage.setItem('isLoggedIn', 'true');
                localStorage.setItem('currentAdmin', JSON.stringify({username: 'admin'}));
                
                // 显示成功消息
                document.getElementById('status').style.display = 'block';
                
                // 自动打开产品管理页面
                window.open('http://localhost:5174/#admin-products', '_blank');
            } catch (error) {
                alert('设置登录状态时出错：' + error.message);
            }
        }
    </script>
</body>
</html>